{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 运算符"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "算术运算符：+ , - , * , / , % , ** ，//"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.177815Z",
     "start_time": "2020-07-16T09:00:27.169815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3.0"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "9/3 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.198815Z",
     "start_time": "2020-07-16T09:00:27.179815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "9%3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.214815Z",
     "start_time": "2020-07-16T09:00:27.201815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "11%3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.227815Z",
     "start_time": "2020-07-16T09:00:27.216815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "8"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    " 2**3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.242815Z",
     "start_time": "2020-07-16T09:00:27.228815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "16"
      ]
     },
     "execution_count": 5,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    " 2**4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.258815Z",
     "start_time": "2020-07-16T09:00:27.244815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "10//3"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "比较运算符： == , != , > , < , >= , <="
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.408815Z",
     "start_time": "2020-07-16T09:00:27.404815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "1 == 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.430815Z",
     "start_time": "2020-07-16T09:00:27.417815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "1 != 2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.443815Z",
     "start_time": "2020-07-16T09:00:27.433815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "2 > 1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.466815Z",
     "start_time": "2020-07-16T09:00:27.445815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "1 > 2 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.486815Z",
     "start_time": "2020-07-16T09:00:27.468815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "1 <= 1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "逻辑运算符：and or not"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.630815Z",
     "start_time": "2020-07-16T09:00:27.626815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    " 3>1 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.650815Z",
     "start_time": "2020-07-16T09:00:27.638815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "2>1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.662815Z",
     "start_time": "2020-07-16T09:00:27.653815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "3>1 and 2>1 and 4>3 "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.676815Z",
     "start_time": "2020-07-16T09:00:27.664815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "3>1 or 1>2 or 2>3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.691815Z",
     "start_time": "2020-07-16T09:00:27.679815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "2>1 and 3>2 or 1>2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.706815Z",
     "start_time": "2020-07-16T09:00:27.693815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "not 2>1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.719815Z",
     "start_time": "2020-07-16T09:00:27.708815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "False"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "not (1>0 and 2>1 and 3>2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.730815Z",
     "start_time": "2020-07-16T09:00:27.721815Z"
    }
   },
   "outputs": [],
   "source": [
    "import os\n",
    "path  = 'd:/123'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.743815Z",
     "start_time": "2020-07-16T09:00:27.732815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "True"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "not os.path.exists(path)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.755815Z",
     "start_time": "2020-07-16T09:00:27.745815Z"
    }
   },
   "outputs": [],
   "source": [
    "if not os.path.exists(path):\n",
    "    os.mkdir(path)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 数据类型_容器_list、set、dict"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 数据类型 int flaot str bool"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:37:44.631401Z",
     "start_time": "2020-07-16T11:37:44.611401Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "int"
      ]
     },
     "execution_count": 1,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(1)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:38:27.979801Z",
     "start_time": "2020-07-16T11:38:27.969801Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "float"
      ]
     },
     "execution_count": 2,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(1.2)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:38:40.758201Z",
     "start_time": "2020-07-16T11:38:40.748201Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "str"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type('feng')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:38:58.443001Z",
     "start_time": "2020-07-16T11:38:58.433001Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "bool"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "bool"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(True)\n",
    "type(False)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 字符串 str"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:44:33.726602Z",
     "start_time": "2020-07-16T11:44:33.716602Z"
    }
   },
   "outputs": [],
   "source": [
    "str4 = 'feng ming shan'"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:44:35.633402Z",
     "start_time": "2020-07-16T11:44:35.618402Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'shan'"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str4[10:]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 拆分字符串"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:44:38.730002Z",
     "start_time": "2020-07-16T11:44:38.715002Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['feng', 'ming', 'shan']"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "\n",
    "li = str4.split(' ')\n",
    "li "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:44:40.815002Z",
     "start_time": "2020-07-16T11:44:40.805002Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['fe', ' mi', ' shan']"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "li2 = str4.split('ng')\n",
    "li2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:47:13.664602Z",
     "start_time": "2020-07-16T11:47:13.649602Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['feng', 'ming', 'shan']"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str3 = 'feng/ming/shan'\n",
    "li3 = str3.split('/')\n",
    "li3 "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 替换字符串"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.940815Z",
     "start_time": "2020-07-16T09:00:27.924815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'fengmingshan'"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str5 = str4.replace(' ','')\n",
    "str5"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.957815Z",
     "start_time": "2020-07-16T09:00:27.942815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['f', 'e', 'n', 'g', 'm', 'i', 'n', 'g', 's', 'h', 'a', 'n']"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "li2 = list('fengmingshan')\n",
    "li2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:27.994815Z",
     "start_time": "2020-07-16T09:00:27.959815Z"
    }
   },
   "outputs": [],
   "source": [
    "str1 = '      feng ming shan        '"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.008815Z",
     "start_time": "2020-07-16T09:00:27.996815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'feng ming shan        '"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str1.lstrip()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.020815Z",
     "start_time": "2020-07-16T09:00:28.011815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'      feng ming shan'"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str1.rstrip()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.032815Z",
     "start_time": "2020-07-16T09:00:28.022815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'feng ming shan'"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str1.strip()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.045815Z",
     "start_time": "2020-07-16T09:00:28.034815Z"
    }
   },
   "outputs": [],
   "source": [
    "str2 = 'feng/ming/shan'"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.060815Z",
     "start_time": "2020-07-16T09:00:28.047815Z"
    }
   },
   "source": [
    "### 字符串的加法和乘法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:48:42.685002Z",
     "start_time": "2020-07-16T11:48:42.665002Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'feng@mingshan*****'"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "'fengfengfeng'"
      ]
     },
     "execution_count": 21,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str5 = 'feng' +'@'+ 'ming' + 'shan'+'*'*5\n",
    "str5\n",
    "\n",
    "'feng'*3"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 使用占位符"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# print函数\n",
    "print('hello world!')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:50:32.603202Z",
     "start_time": "2020-07-16T11:50:32.593202Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "我的名字叫：冯明山,我今年20岁,我的工作是：网络优化\n"
     ]
    }
   ],
   "source": [
    "name ='冯明山'\n",
    "age = 20\n",
    "work = '网络优化'\n",
    "print('我的名字叫：{},我今年{}岁,我的工作是：{}！'.format(name,age,work))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 列表 list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 创建list"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:54:47.147503Z",
     "start_time": "2020-07-16T11:54:47.132503Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['feng', 'ming', 'shan']"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list1 = 'feng ming shan'.split(' ')\n",
    "list1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:53:25.894103Z",
     "start_time": "2020-07-16T11:53:25.879103Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['feng', 'ming', 'shan']"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 等效\n",
    "list1 = ['feng','ming','shan']\n",
    "list1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:54:50.899103Z",
     "start_time": "2020-07-16T11:54:50.889103Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "#计算list的长度\n",
    "len(list1)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### 取list的元素"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.247815Z",
     "start_time": "2020-07-16T09:00:28.236815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'feng'"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "'ming'"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "'shan'"
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list1[0]\n",
    "list1[1]\n",
    "list1[2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.276815Z",
     "start_time": "2020-07-16T09:00:28.260815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'ming'"
      ]
     },
     "execution_count": 37,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list1[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.293815Z",
     "start_time": "2020-07-16T09:00:28.279815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'shan'"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list1[2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.310815Z",
     "start_time": "2020-07-16T09:00:28.296815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'feng/ming/shan'"
      ]
     },
     "execution_count": 39,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list1[0] +'/'+list1[1] +'/'+ list1[2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.366815Z",
     "start_time": "2020-07-16T09:00:28.355815Z"
    }
   },
   "outputs": [],
   "source": [
    "list2 = ['feng','ming','shan']\n",
    "list3 = list2[1:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.390815Z",
     "start_time": "2020-07-16T09:00:28.368815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "list"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "'ming'"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "'shan'"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "type(list3)\n",
    "list3[0]\n",
    "list3[1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.401815Z",
     "start_time": "2020-07-16T09:00:28.392815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'ming'"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "str1 = list2[-2]\n",
    "str1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### list的切片"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.415815Z",
     "start_time": "2020-07-16T09:00:28.405815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['ming', 'shan']"
      ]
     },
     "execution_count": 46,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list2[-2:]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.434815Z",
     "start_time": "2020-07-16T09:00:28.417815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 3, 5, 7]"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "[2, 4, 6, 8]"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list3= [1,2,3,4,5,6,7,8]\n",
    "\n",
    "list3[0::2]\n",
    "\n",
    "list3[1::2]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.447815Z",
     "start_time": "2020-07-16T09:00:28.436815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[8, 7, 6, 5, 4, 3, 2, 1]"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list4 = list3[::-1]\n",
    "list4"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 49,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.462815Z",
     "start_time": "2020-07-16T09:00:28.449815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "78718856"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "78718856"
      ]
     },
     "execution_count": 49,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list4 = list3\n",
    "id(list3)\n",
    "id(list4)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.475815Z",
     "start_time": "2020-07-16T09:00:28.464815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3, 4, 5, 6, 7, 8]"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "78718856"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "84165896"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list5 = list3[::1]\n",
    "list5\n",
    "id(list3)\n",
    "id(list5)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 55,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.533815Z",
     "start_time": "2020-07-16T09:00:28.525815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[8, 6, 4, 2]"
      ]
     },
     "execution_count": 55,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list6 = list3[::-2]\n",
    "list6"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### list的加法和乘法"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:42:26.797201Z",
     "start_time": "2020-07-16T11:42:26.782201Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3, 4, 5, 6, 7, 8]"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# list 直接相加\n",
    "list1 = [1,2,3,4]\n",
    "list2 = [5,6,7,8]\n",
    "list3 = list1+list2\n",
    "list3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:42:53.437801Z",
     "start_time": "2020-07-16T11:42:53.422801Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 2, 3, 4, 1, 2, 3, 4]"
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# list 乘法，重复多少次\n",
    "list4= list1*2\n",
    "list4"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 字典 dict"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:41:14.603601Z",
     "start_time": "2020-07-16T11:41:14.593601Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'冯明山'"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "20"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict1 = {'name':'冯明山','age':20,'work':'网优'}\n",
    "\n",
    "dict1['name']\n",
    "\n",
    "dict1['age']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:41:17.169801Z",
     "start_time": "2020-07-16T11:41:17.159801Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'冯明山'"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict1.get('name')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:41:19.824801Z",
     "start_time": "2020-07-16T11:41:19.814801Z"
    }
   },
   "outputs": [],
   "source": [
    "dict1.get('na')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:41:22.149801Z",
     "start_time": "2020-07-16T11:41:22.134801Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'查不到'"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict1.setdefault('na','查不到')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T11:41:29.781601Z",
     "start_time": "2020-07-16T11:41:29.766601Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'查不到'"
      ]
     },
     "execution_count": 10,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "dict1.get('na')"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 集合 set "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 60,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.909815Z",
     "start_time": "2020-07-16T09:00:28.902815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1, 2, 3, 4}"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "{1, 2, 3, 4}"
      ]
     },
     "execution_count": 60,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "set1 = set([1,1,2,2,3,3,4,4])\n",
    "\n",
    "set1\n",
    "set1.add(1)\n",
    "set1"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 61,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.935815Z",
     "start_time": "2020-07-16T09:00:28.915815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{3, 4, 5, 6, 7}"
      ]
     },
     "execution_count": 61,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list9 = [3,3,4,4,5,6,7]\n",
    "\n",
    "set2 = set(list9)\n",
    "set2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 62,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.947815Z",
     "start_time": "2020-07-16T09:00:28.937815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{3, 4}"
      ]
     },
     "execution_count": 62,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "set1&set2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 63,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.959815Z",
     "start_time": "2020-07-16T09:00:28.950815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{1, 2, 3, 4, 5, 6, 7}"
      ]
     },
     "execution_count": 63,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "set1|set2"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 64,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:28.971815Z",
     "start_time": "2020-07-16T09:00:28.961815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "{5, 6, 7}"
      ]
     },
     "execution_count": 64,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "set2 - set1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 元组 truple"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# 待补充"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 条件语句"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 65,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:29.373815Z",
     "start_time": "2020-07-16T09:00:29.370815Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "13是奇数。\n"
     ]
    }
   ],
   "source": [
    "a = 13\n",
    "if a%2 == 0:\n",
    "    print('{}是偶数。'.format(a))\n",
    "else:\n",
    "    print('{}是奇数。'.format(a))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 66,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:29.392815Z",
     "start_time": "2020-07-16T09:00:29.379815Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MOD3余数是2。\n"
     ]
    }
   ],
   "source": [
    "a = 17 \n",
    "if a%3 == 0:\n",
    "    print('MOD3余数是0。')\n",
    "elif a%3 == 1:\n",
    "    print('MOD3余数是1。')\n",
    "else:\n",
    "    print('MOD3余数是2。')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 67,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:29.405815Z",
     "start_time": "2020-07-16T09:00:29.395815Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "MOD3余数是0。\n"
     ]
    }
   ],
   "source": [
    "a = 12\n",
    "if a%3 == 0 and a > 10:\n",
    "    print('MOD3余数是0。')\n",
    "elif a%3 == 1:\n",
    "    print('MOD3余数是1。')\n",
    "elif a%3 == 2:\n",
    "    print('MOD3余数是2。')\n",
    "       "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 68,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:29.426815Z",
     "start_time": "2020-07-16T09:00:29.407815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[168, 169]"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "[165]"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "[160]"
      ]
     },
     "execution_count": 68,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "list1 = [160,165,168,169]\n",
    "li1 = []\n",
    "li2 = []\n",
    "li3 = []\n",
    "for i in list1:\n",
    "    if i > 165:\n",
    "        li1.append(i)\n",
    "    elif i > 160: \n",
    "        li2.append(i)\n",
    "    else:\n",
    "        li3.append(i)\n",
    "li1\n",
    "li2\n",
    "li3"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 循环语句"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 69,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:29.620815Z",
     "start_time": "2020-07-16T09:00:29.617815Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a\n",
      "b\n",
      "c\n"
     ]
    }
   ],
   "source": [
    "# 为什么要循环\n",
    "li = ['a','b','c','d','e','f','g','h']\n",
    "print(li[0])\n",
    "print(li[1])\n",
    "print(li[2])"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## for循环"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 70,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:29.846815Z",
     "start_time": "2020-07-16T09:00:29.842815Z"
    },
    "code_folding": []
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a\n",
      "b\n",
      "c\n",
      "d\n",
      "e\n"
     ]
    }
   ],
   "source": [
    "# 直接对list的元素进行循环\n",
    "for x in li:\n",
    "    print(x)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 71,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:29.864815Z",
     "start_time": "2020-07-16T09:00:29.850815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "5"
      ]
     },
     "execution_count": 71,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "len(li)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 72,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:29.886815Z",
     "start_time": "2020-07-16T09:00:29.866815Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n",
      "3\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "# 通过range循环\n",
    "for i in range(0,5):\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 73,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:29.901815Z",
     "start_time": "2020-07-16T09:00:29.888815Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "0\n",
      "1\n",
      "2\n",
      "3\n",
      "4\n"
     ]
    }
   ],
   "source": [
    "for i in range(0,len(li)):\n",
    "    print(i)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 74,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:29.913815Z",
     "start_time": "2020-07-16T09:00:29.903815Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "a\n",
      "b\n",
      "c\n",
      "d\n",
      "e\n"
     ]
    }
   ],
   "source": [
    "# 通过下标对list循环\n",
    "for i in range(0,len(li)):\n",
    "    print(li[i])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 75,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:29.931815Z",
     "start_time": "2020-07-16T09:00:29.916815Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "hello\n",
      "hello\n",
      "hello\n",
      "hello\n",
      "hello\n",
      "hello\n",
      "hello\n",
      "hello\n",
      "hello\n",
      "hello\n"
     ]
    }
   ],
   "source": [
    "# 循环做某件事一定的次数\n",
    "for i in range(0,10):\n",
    "    print('hello')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 76,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:29.955815Z",
     "start_time": "2020-07-16T09:00:29.934815Z"
    }
   },
   "outputs": [],
   "source": [
    "li2 = [1,2,3,4]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 77,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:29.969815Z",
     "start_time": "2020-07-16T09:00:29.957815Z"
    }
   },
   "outputs": [],
   "source": [
    "li3 = [] "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 78,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:29.985815Z",
     "start_time": "2020-07-16T09:00:29.971815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[1, 4, 9, 16]"
      ]
     },
     "execution_count": 78,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "for x in li2:\n",
    "    li3.append(x**2)\n",
    "li3"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## while 循环"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "while循环能做的for循环也能做，所以while 循环了解就行了，不是重点。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 79,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:30.377815Z",
     "start_time": "2020-07-16T09:00:30.375815Z"
    }
   },
   "outputs": [],
   "source": [
    "li4  = [1,2,3,4,5,6,7,8,9,10]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 95,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:01:06.931616Z",
     "start_time": "2020-07-16T09:01:06.926616Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "1\n",
      "2\n",
      "3\n",
      "4\n",
      "5\n"
     ]
    }
   ],
   "source": [
    "i = 0\n",
    "while i < 5:\n",
    "    print(li4[i])\n",
    "    i += 1"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "while循环最大的用处就是一些需要永远执行的任务比如每天从数据库提取报表，监控某个程序的运行状态等等，一般使用while循环,例如："
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 81,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:30.830815Z",
     "start_time": "2020-07-16T09:00:30.760815Z"
    }
   },
   "outputs": [
    {
     "ename": "NameError",
     "evalue": "name '做XXX事情' is not defined",
     "output_type": "error",
     "traceback": [
      "\u001b[1;31m---------------------------------------------------------------------------\u001b[0m",
      "\u001b[1;31mNameError\u001b[0m                                 Traceback (most recent call last)",
      "\u001b[1;32m<ipython-input-81-d235b8a7f07f>\u001b[0m in \u001b[0;36m<module>\u001b[1;34m()\u001b[0m\n\u001b[0;32m      1\u001b[0m \u001b[1;32mwhile\u001b[0m \u001b[1;32mTrue\u001b[0m\u001b[1;33m:\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[1;32m----> 2\u001b[1;33m     \u001b[0m做XXX事情\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n\u001b[0m\u001b[0;32m      3\u001b[0m \u001b[1;31m#因为这里的True永远都不会改变，所以只要电脑不死机这件事情就会一直做下去\u001b[0m\u001b[1;33m\u001b[0m\u001b[1;33m\u001b[0m\u001b[0m\n",
      "\u001b[1;31mNameError\u001b[0m: name '做XXX事情' is not defined"
     ]
    }
   ],
   "source": [
    "while True:\n",
    "    做XXX事情\n",
    "#因为这里的True永远都不会改变，所以只要电脑不死机这件事情就会一直做下去"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 两个条件语句的例子"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 学生成绩分等级。这是一个最典型也是最简单的条件语句"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "将学生考试成绩（score）分为5个等级（grade）：\n",
    "90-100分的为'优'；\n",
    "80-90分的为'良'；\n",
    "70-80分的为'中'；\n",
    "60-70分的为'差'；\n",
    "60分以下的为'不合格'；\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 97,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:03:08.854216Z",
     "start_time": "2020-07-16T09:03:08.849216Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'优'"
      ]
     },
     "execution_count": 97,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "score = 95\n",
    "\n",
    "if score >= 90 and  score <= 100 :\n",
    "    grade = '优'\n",
    "elif score >= 80 and  score < 90 :\n",
    "    grade = '良'\n",
    "elif score >= 70 and  score < 80 :\n",
    "    grade = '中'\n",
    "elif score >= 60 and  score < 70 :\n",
    "    grade = '差'\n",
    "else:\n",
    "    grade = '不合格'\n",
    "    \n",
    "grade"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## 吃早点 。这个例子非常复杂，请自己尝试修改条件多实操几遍，深刻领会。"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "有一个人，他早点习惯吃油条。如果早点铺有油条他就选油条，最好是搭配豆浆；没有豆浆的话稀豆粉也可以；没有稀豆粉，稀饭也可以；没有稀饭的话，他就不吃油条，因为太干了吃不下；他就改吃米线或面条。如果早点铺没有油条，他就吃米线；如果没有米线，他就吃面条，如果连面条都没有他就不吃早点。\n",
    "早点铺1-5卖的早点各不相同，用一个条件语句判断他会吃什么早点。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 98,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:07:19.554017Z",
     "start_time": "2020-07-16T09:07:19.547017Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['油条', '豆浆']"
      ]
     },
     "execution_count": 98,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "zao_dian_pu1 = ['油条','豆浆','稀豆粉','稀饭','米线','面条'] \n",
    "my_zaodian = []\n",
    "\n",
    "if '油条' in zao_dian_pu1:\n",
    "    my_zaodian.append('油条')\n",
    "    if '豆浆' in zao_dian_pu1:\n",
    "        my_zaodian.append('豆浆')\n",
    "    elif '稀豆粉' in zao_dian_pu1:\n",
    "        my_zaodian.append('稀豆粉')\n",
    "    elif '稀饭' in zao_dian_pu1:\n",
    "        my_zaodian.append('稀饭')\n",
    "    else:\n",
    "        my_zaodian.remove('油条')\n",
    "#         if '米线' in zao_dian_pu1:\n",
    "#             my_zaodian.append('米线')\n",
    "#         elif '面条' in zao_dian_pu1:\n",
    "#             my_zaodian.append('面条') \n",
    "#         else:\n",
    "#             pass\n",
    "elif '米线' in zao_dian_pu1:\n",
    "    my_zaodian.append('米线')\n",
    "elif '面条' in zao_dian_pu1:\n",
    "    my_zaodian.append('面条')\n",
    "else:\n",
    "    pass\n",
    "\n",
    "my_zaodian"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 99,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:07:35.774417Z",
     "start_time": "2020-07-16T09:07:35.768417Z"
    },
    "code_folding": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['油条', '稀饭']"
      ]
     },
     "execution_count": 99,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "zao_dian_pu2 = ['油条','稀饭','米线','面条'] \n",
    "my_zaodian = []\n",
    "\n",
    "if '油条' in zao_dian_pu2:\n",
    "    my_zaodian.append('油条')\n",
    "    if '豆浆' in zao_dian_pu2:\n",
    "        my_zaodian.append('豆浆')\n",
    "    elif '稀豆粉' in zao_dian_pu2:\n",
    "        my_zaodian.append('稀豆粉')\n",
    "    elif '稀饭' in zao_dian_pu2:\n",
    "        my_zaodian.append('稀饭')\n",
    "    else:\n",
    "        my_zaodian.remove('油条')\n",
    "        if '米线' in zao_dian_pu2:\n",
    "            my_zaodian.append('米线')\n",
    "        elif '面条' in zao_dian_pu2:\n",
    "            my_zaodian.append('面条') \n",
    "        else:\n",
    "            pass\n",
    "elif '米线' in zao_dian_pu2:\n",
    "    my_zaodian.append('米线')\n",
    "elif '面条' in zao_dian_pu2:\n",
    "    my_zaodian.append('面条')\n",
    "else:\n",
    "    pass\n",
    "\n",
    "my_zaodian"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 100,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:07:59.300817Z",
     "start_time": "2020-07-16T09:07:59.292817Z"
    },
    "code_folding": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[]"
      ]
     },
     "execution_count": 100,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "zao_dian_pu3 = ['油条','包子','馒头'] \n",
    "my_zaodian = []\n",
    "\n",
    "if '油条' in zao_dian_pu3:\n",
    "    my_zaodian.append('油条')\n",
    "    if '豆浆' in zao_dian_pu3:\n",
    "        my_zaodian.append('豆浆')\n",
    "    elif '稀豆粉' in zao_dian_pu3:\n",
    "        my_zaodian.append('稀豆粉')\n",
    "    elif '稀饭' in zao_dian_pu3:\n",
    "        my_zaodian.append('稀饭')\n",
    "    else:\n",
    "        my_zaodian.remove('油条')\n",
    "        if '米线' in zao_dian_pu3:\n",
    "            my_zaodian.append('米线')\n",
    "        elif '面条' in zao_dian_pu3:\n",
    "            my_zaodian.append('面条') \n",
    "        else:\n",
    "            pass\n",
    "elif '米线' in zao_dian_pu3:\n",
    "    my_zaodian.append('米线')\n",
    "elif '面条' in zao_dian_pu3:\n",
    "    my_zaodian.append('面条')\n",
    "else:\n",
    "    pass\n",
    "\n",
    "my_zaodian"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 103,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:11:03.743817Z",
     "start_time": "2020-07-16T09:11:03.737817Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['米线']"
      ]
     },
     "execution_count": 103,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "zao_dian_pu4 = ['油条','米线','面条'] \n",
    "my_zaodian = []\n",
    "\n",
    "if '油条' in zao_dian_pu4:\n",
    "    my_zaodian.append('油条')\n",
    "    if '豆浆' in zao_dian_pu4:\n",
    "        my_zaodian.append('豆浆')\n",
    "    elif '稀豆粉' in zao_dian_pu4:\n",
    "        my_zaodian.append('稀豆粉')\n",
    "    elif '稀饭' in zao_dian_pu4:\n",
    "        my_zaodian.append('稀饭')\n",
    "    else:\n",
    "        my_zaodian.remove('油条')\n",
    "        if '米线' in zao_dian_pu4:\n",
    "            my_zaodian.append('米线')\n",
    "        elif '面条' in zao_dian_pu4:\n",
    "            my_zaodian.append('面条') \n",
    "        else:\n",
    "            pass\n",
    "elif '米线' in zao_dian_pu4:\n",
    "    my_zaodian.append('米线')\n",
    "elif '面条' in zao_dian_pu4:\n",
    "    my_zaodian.append('面条')\n",
    "else:\n",
    "    pass\n",
    "\n",
    "my_zaodian"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 104,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:11:37.206817Z",
     "start_time": "2020-07-16T09:11:37.198817Z"
    },
    "code_folding": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['面条']"
      ]
     },
     "execution_count": 104,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "zao_dian_pu5 = ['油条','面条'] \n",
    "my_zaodian = []\n",
    "\n",
    "if '油条' in zao_dian_pu5:\n",
    "    my_zaodian.append('油条')\n",
    "    if '豆浆' in zao_dian_pu5:\n",
    "        my_zaodian.append('豆浆')\n",
    "    elif '稀豆粉' in zao_dian_pu5:\n",
    "        my_zaodian.append('稀豆粉')\n",
    "    elif '稀饭' in zao_dian_pu5:\n",
    "        my_zaodian.append('稀饭')\n",
    "    else:\n",
    "        my_zaodian.remove('油条')\n",
    "        if '米线' in zao_dian_pu5:\n",
    "            my_zaodian.append('米线')\n",
    "        elif '面条' in zao_dian_pu5:\n",
    "            my_zaodian.append('面条') \n",
    "        else:\n",
    "            pass\n",
    "elif '米线' in zao_dian_pu5:\n",
    "    my_zaodian.append('米线')\n",
    "elif '面条' in zao_dian_pu5:\n",
    "    my_zaodian.append('面条')\n",
    "else:\n",
    "    pass\n",
    "\n",
    "my_zaodian"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# 一个循环语句的例子,循环很好理解，但是循环往往会和条件语句一起使用，本例就是循环加语句条件语句"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "你是一个上班族，如果是星期1-5你早上7:00起床上班，下午5:30下班，晚上10:00睡觉。\n",
    "如果是星期6和星期7，你睡懒觉到12:00才起床，从13:00开始打游戏,到晚上12:00才睡觉。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 105,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:14:09.100818Z",
     "start_time": "2020-07-16T09:14:09.090818Z"
    }
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "==========\n",
      "今天是星期1\n",
      "早上7:00起床上班。\n",
      "下午5:30下班。\n",
      "晚上10:00睡觉。\n",
      "==========\n",
      "今天是星期2\n",
      "早上7:00起床上班。\n",
      "下午5:30下班。\n",
      "晚上10:00睡觉。\n",
      "==========\n",
      "今天是星期3\n",
      "早上7:00起床上班。\n",
      "下午5:30下班。\n",
      "晚上10:00睡觉。\n",
      "==========\n",
      "今天是星期4\n",
      "早上7:00起床上班。\n",
      "下午5:30下班。\n",
      "晚上10:00睡觉。\n",
      "==========\n",
      "今天是星期5\n",
      "早上7:00起床上班。\n",
      "下午5:30下班。\n",
      "晚上10:00睡觉。\n",
      "##########\n",
      "今天是星期6\n",
      "中午12:00起床。\n",
      "从13:00开始打游戏。\n",
      "晚上12:00睡觉。\n",
      "##########\n",
      "今天是星期7\n",
      "中午12:00起床。\n",
      "从13:00开始打游戏。\n",
      "晚上12:00睡觉。\n"
     ]
    }
   ],
   "source": [
    "day_list = [1,2,3,4,5,6,7]\n",
    "for day in day_list:\n",
    "    if day<=5:\n",
    "        print('='*10)\n",
    "        print('今天是星期{}'.format(day))\n",
    "        print('早上7:00起床上班。')\n",
    "        print('下午5:30下班。')\n",
    "        print('晚上10:00睡觉。')\n",
    "    elif day == 6 or day == 7 :\n",
    "        print('#'*10)\n",
    "        print('今天是星期{}'.format(day))\n",
    "        print('中午12:00起床。')\n",
    "        print('从13:00开始打游戏。')\n",
    "        print('晚上12:00睡觉。')"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 89,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:32.410815Z",
     "start_time": "2020-07-16T09:00:32.393815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "'python'"
      ]
     },
     "execution_count": 89,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a = 'pyth'\n",
    "b= 'on'\n",
    "a += b\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 90,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:32.429815Z",
     "start_time": "2020-07-16T09:00:32.412815Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "7"
      ]
     },
     "execution_count": 90,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "a=3\n",
    "b=4\n",
    "a +=b\n",
    "a"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 91,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:00:32.444815Z",
     "start_time": "2020-07-16T09:00:32.431815Z"
    }
   },
   "outputs": [],
   "source": [
    "import os"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 109,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:20:50.622219Z",
     "start_time": "2020-07-16T09:20:50.612219Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "['3GCI数据库制作',\n",
       " '3GI空闲CI核查',\n",
       " '3G邻区自动优化',\n",
       " '3G配置数据合并',\n",
       " '4GIP地址规划',\n",
       " '4G邻区距离计算',\n",
       " '800M非标带宽配置脚本生成',\n",
       " 'DT测试数据重构',\n",
       " 'MR报表',\n",
       " 'NOC工单分类_textCNN',\n",
       " 'python读写word文档',\n",
       " '不支持800M终端分析',\n",
       " '修改Excel表格样式',\n",
       " '删除DO载频',\n",
       " '制作修改TAC脚本',\n",
       " '制作添加DO小区脚本',\n",
       " '小区退服计算',\n",
       " '感知工单分析报告',\n",
       " '投诉清单添加区县',\n",
       " '提取IMS用户MDN,IMSI,SIFC信息',\n",
       " '新开站邻区规划',\n",
       " '根据经纬度计算基站间距离',\n",
       " '爱立信告警统计',\n",
       " '王亚波KPI指标计算',\n",
       " '网络部KPI指标计算',\n",
       " '话务报表WEB_APP',\n",
       " '读写word文档',\n",
       " '资金往来自动核对',\n",
       " '超忙小区分析']"
      ]
     },
     "execution_count": 109,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "['感知工单分析报告']"
      ]
     },
     "execution_count": 109,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "text/plain": [
       "['730448_6_沾益西平西闸村感知质差分析报告.docx',\n",
       " 'MR详表_20190925.csv',\n",
       " 'pic',\n",
       " '历史性能_曲靖KPI指标_20190930164320.csv']"
      ]
     },
     "execution_count": 109,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "path = r'D:\\_python小程序'\n",
    "os.chdir(path)\n",
    "list1 = os.listdir()\n",
    "list1\n",
    "list2 = [x for x in list1 if '报告' in x]\n",
    "list2\n",
    "list3 = os.listdir('./'+ list2[0])\n",
    "list3"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 115,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:24:32.432020Z",
     "start_time": "2020-07-16T09:24:31.212820Z"
    }
   },
   "outputs": [],
   "source": [
    "import pandas as pd\n",
    "os.chdir(path + './'+ list2[0])\n",
    "df = pd.read_csv('MR详表_20190925.csv',engine= 'python')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 117,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:25:07.440820Z",
     "start_time": "2020-07-16T09:25:07.436820Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Index(['区域', '时间周期', 'NAME', '厂家', '是否800M设备', '平均RSRP（dBm）', '|≥-105dBm采样点',\n",
       "       '|≥-110dBm采样点', '|≥-115dBm采样点', '|≥-120dBm采样点', '|≥负无穷采样点'],\n",
       "      dtype='object')"
      ]
     },
     "execution_count": 117,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.columns\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 125,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:28:22.687821Z",
     "start_time": "2020-07-16T09:28:22.675821Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>区域</th>\n",
       "      <th>时间周期</th>\n",
       "      <th>NAME</th>\n",
       "      <th>厂家</th>\n",
       "      <th>是否800M设备</th>\n",
       "      <th>平均RSRP（dBm）</th>\n",
       "      <th>|≥-105dBm采样点</th>\n",
       "      <th>|≥-110dBm采样点</th>\n",
       "      <th>|≥-115dBm采样点</th>\n",
       "      <th>|≥-120dBm采样点</th>\n",
       "      <th>|≥负无穷采样点</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>楚雄州</td>\n",
       "      <td>2019/9/25</td>\n",
       "      <td>581632_145_R8862A S8500(A6A)CX楚雄东瓜医专新区_DW0CC0_...</td>\n",
       "      <td>中兴</td>\n",
       "      <td>是</td>\n",
       "      <td>-71.96</td>\n",
       "      <td>1562</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>楚雄州</td>\n",
       "      <td>2019/9/25</td>\n",
       "      <td>581632_146_R8862A S8500(A6A)CX楚雄东瓜医专新区_DW0CC0_...</td>\n",
       "      <td>中兴</td>\n",
       "      <td>是</td>\n",
       "      <td>-88.46</td>\n",
       "      <td>1638</td>\n",
       "      <td>8</td>\n",
       "      <td>3</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>楚雄州</td>\n",
       "      <td>2019/9/25</td>\n",
       "      <td>581632_147_R8862A S8500(A6A)CX楚雄东瓜医专新区_DW0CC0_...</td>\n",
       "      <td>中兴</td>\n",
       "      <td>是</td>\n",
       "      <td>-93.62</td>\n",
       "      <td>1214</td>\n",
       "      <td>2</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>楚雄州</td>\n",
       "      <td>2019/9/25</td>\n",
       "      <td>581633_145_R8862A S8500(A6A)CX楚雄东瓜彝人古镇大酒店_HW0C...</td>\n",
       "      <td>中兴</td>\n",
       "      <td>是</td>\n",
       "      <td>-68.57</td>\n",
       "      <td>1173</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>楚雄州</td>\n",
       "      <td>2019/9/25</td>\n",
       "      <td>581633_146_R8862A S8500(A6A)CX楚雄东瓜彝人古镇大酒店_HW0C...</td>\n",
       "      <td>中兴</td>\n",
       "      <td>是</td>\n",
       "      <td>-98.79</td>\n",
       "      <td>1350</td>\n",
       "      <td>71</td>\n",
       "      <td>6</td>\n",
       "      <td>1</td>\n",
       "      <td>0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "    区域       时间周期                                               NAME  厂家  \\\n",
       "0  楚雄州  2019/9/25  581632_145_R8862A S8500(A6A)CX楚雄东瓜医专新区_DW0CC0_...  中兴   \n",
       "1  楚雄州  2019/9/25  581632_146_R8862A S8500(A6A)CX楚雄东瓜医专新区_DW0CC0_...  中兴   \n",
       "2  楚雄州  2019/9/25  581632_147_R8862A S8500(A6A)CX楚雄东瓜医专新区_DW0CC0_...  中兴   \n",
       "3  楚雄州  2019/9/25  581633_145_R8862A S8500(A6A)CX楚雄东瓜彝人古镇大酒店_HW0C...  中兴   \n",
       "4  楚雄州  2019/9/25  581633_146_R8862A S8500(A6A)CX楚雄东瓜彝人古镇大酒店_HW0C...  中兴   \n",
       "\n",
       "  是否800M设备  平均RSRP（dBm）  |≥-105dBm采样点  |≥-110dBm采样点  |≥-115dBm采样点  \\\n",
       "0        是       -71.96          1562             1             0   \n",
       "1        是       -88.46          1638             8             3   \n",
       "2        是       -93.62          1214             2             0   \n",
       "3        是       -68.57          1173             1             0   \n",
       "4        是       -98.79          1350            71             6   \n",
       "\n",
       "   |≥-120dBm采样点  |≥负无穷采样点  \n",
       "0             0         0  \n",
       "1             0         0  \n",
       "2             0         0  \n",
       "3             1         0  \n",
       "4             1         0  "
      ]
     },
     "execution_count": 125,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.head(5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 119,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:25:57.950221Z",
     "start_time": "2020-07-16T09:25:57.891221Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>平均RSRP（dBm）</th>\n",
       "      <th>|≥-105dBm采样点</th>\n",
       "      <th>|≥-110dBm采样点</th>\n",
       "      <th>|≥-115dBm采样点</th>\n",
       "      <th>|≥-120dBm采样点</th>\n",
       "      <th>|≥负无穷采样点</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>132139.000000</td>\n",
       "      <td>1.321390e+05</td>\n",
       "      <td>132139.000000</td>\n",
       "      <td>132139.000000</td>\n",
       "      <td>132139.000000</td>\n",
       "      <td>132139.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>-93.498095</td>\n",
       "      <td>2.815213e+04</td>\n",
       "      <td>2963.087226</td>\n",
       "      <td>1306.365706</td>\n",
       "      <td>562.364313</td>\n",
       "      <td>251.230954</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>7.299873</td>\n",
       "      <td>4.925879e+04</td>\n",
       "      <td>5826.790091</td>\n",
       "      <td>2675.467132</td>\n",
       "      <td>1405.337720</td>\n",
       "      <td>877.458547</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>-120.000000</td>\n",
       "      <td>0.000000e+00</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "      <td>0.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>-98.280000</td>\n",
       "      <td>1.666000e+03</td>\n",
       "      <td>135.000000</td>\n",
       "      <td>56.000000</td>\n",
       "      <td>17.000000</td>\n",
       "      <td>4.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>-93.550000</td>\n",
       "      <td>8.932000e+03</td>\n",
       "      <td>778.000000</td>\n",
       "      <td>341.000000</td>\n",
       "      <td>116.000000</td>\n",
       "      <td>36.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>-88.940000</td>\n",
       "      <td>3.211300e+04</td>\n",
       "      <td>3183.000000</td>\n",
       "      <td>1363.000000</td>\n",
       "      <td>514.000000</td>\n",
       "      <td>188.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>-60.000000</td>\n",
       "      <td>2.044511e+06</td>\n",
       "      <td>225502.000000</td>\n",
       "      <td>109827.000000</td>\n",
       "      <td>55875.000000</td>\n",
       "      <td>59781.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "         平均RSRP（dBm）  |≥-105dBm采样点   |≥-110dBm采样点   |≥-115dBm采样点  \\\n",
       "count  132139.000000  1.321390e+05  132139.000000  132139.000000   \n",
       "mean      -93.498095  2.815213e+04    2963.087226    1306.365706   \n",
       "std         7.299873  4.925879e+04    5826.790091    2675.467132   \n",
       "min      -120.000000  0.000000e+00       0.000000       0.000000   \n",
       "25%       -98.280000  1.666000e+03     135.000000      56.000000   \n",
       "50%       -93.550000  8.932000e+03     778.000000     341.000000   \n",
       "75%       -88.940000  3.211300e+04    3183.000000    1363.000000   \n",
       "max       -60.000000  2.044511e+06  225502.000000  109827.000000   \n",
       "\n",
       "        |≥-120dBm采样点       |≥负无穷采样点  \n",
       "count  132139.000000  132139.000000  \n",
       "mean      562.364313     251.230954  \n",
       "std      1405.337720     877.458547  \n",
       "min         0.000000       0.000000  \n",
       "25%        17.000000       4.000000  \n",
       "50%       116.000000      36.000000  \n",
       "75%       514.000000     188.000000  \n",
       "max     55875.000000   59781.000000  "
      ]
     },
     "execution_count": 119,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 121,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:27:09.189621Z",
     "start_time": "2020-07-16T09:27:09.174621Z"
    }
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array(['楚雄州', '昭通市', '德宏州', '西双版纳州', '曲靖市', '普洱市', '大理州', '红河州', '丽江市',\n",
       "       '临沧市', '文山州', '玉溪市', '保山市', '怒江州', '昆明市', '迪庆州'], dtype=object)"
      ]
     },
     "execution_count": 121,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "df['区域'].unique()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 124,
   "metadata": {
    "ExecuteTime": {
     "end_time": "2020-07-16T09:28:20.331421Z",
     "start_time": "2020-07-16T09:28:20.324421Z"
    }
   },
   "outputs": [],
   "source": [
    "df['|≥-105dBm采样点'] = df['|≥-105dBm采样点']+1000"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.0"
  },
  "toc": {
   "base_numbering": 1,
   "nav_menu": {},
   "number_sections": true,
   "sideBar": true,
   "skip_h1_title": false,
   "title_cell": "Table of Contents",
   "title_sidebar": "Contents",
   "toc_cell": false,
   "toc_position": {
    "height": "calc(100% - 180px)",
    "left": "10px",
    "top": "150px",
    "width": "273.188px"
   },
   "toc_section_display": true,
   "toc_window_display": true
  },
  "varInspector": {
   "cols": {
    "lenName": 16,
    "lenType": 16,
    "lenVar": 40
   },
   "kernels_config": {
    "python": {
     "delete_cmd_postfix": "",
     "delete_cmd_prefix": "del ",
     "library": "var_list.py",
     "varRefreshCmd": "print(var_dic_list())"
    },
    "r": {
     "delete_cmd_postfix": ") ",
     "delete_cmd_prefix": "rm(",
     "library": "var_list.r",
     "varRefreshCmd": "cat(var_dic_list()) "
    }
   },
   "types_to_exclude": [
    "module",
    "function",
    "builtin_function_or_method",
    "instance",
    "_Feature"
   ],
   "window_display": false
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
